<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/commons.jsp" %>
<html>
	<head>
		<title>我的微博</title>		
		<link rel="stylesheet" type="text/css" href="${ctx }/css/style.css" />
		<link rel="stylesheet" type="text/css" href="${ctx }/css/thickbox.css" />
		<link rel="stylesheet" type="text/css" href="${ctx }/css/uploadify.css" media="screen" />
		<script type="text/javascript" src="${ctx }/js/jquery.js"></script>
		<script type="text/javascript" src="${ctx }/js/weibo.js"></script>
		<script type="text/javascript" src="${ctx }/js/thickbox.js"></script>		
		<script type="text/javascript" src="${ctx }/js/swfobject.js"></script>
		<script type="text/javascript" src="${ctx }/js/jquery.uploadify.v2.1.4.js"></script>
	</head>
	<body>
		<span id="ctx" title="${ctx }"></span>
		<c:if test="${sessionScope.user eq null}">
			<c:redirect url="/index.jsp" />
		</c:if>
		<div id="wrap">
			<div id="global_header">
				<div class="content">
					<a href="${ctx }/${sessionScope.user.id }">首页</a>
					<a href="${ctx }/${sessionScope.user.id }/profile">我的微博</a>
					<a href="${ctx }/settings/avatar">设置头像</a>
					<a href="${ctx }/logout">退出</a>
					<form action="${ctx }/search" method="post">
							<input type="text" name="usernick" />
							<input type="submit" value="搜索" />
					</form>
				</div>
			</div>
			<div id="container">
				<div id="main">
					<div id="content">
						<div id="left">
							<img src="${ctx }/avatar/${sessionScope.user.avatar }" width="150" />
						</div>
						<div id="center">
							<div id="weibo">
								<ul id="weibolist">
									<c:forEach var="weibo" items="${sessionScope.result }">
									<li id="weibo_${weibo[6] }">
										<div id="weibo_left">
											<img src="${ctx }/avatar/${weibo[1] }" width="50" />
										</div>
										<div id="weibo_right">
											<div id="weibo_content">
												<a href="#">${weibo[4] }</a>：${weibo[2] }${weibo[8].allComments }
												<div class="picture">
													<a href="${ctx }/uploads/${weibo[9] }" class="thickbox">
														<img src="${ctx }/uploads/${weibo[9] }" title="查看大图"/>
													</a>
												</div>
											</div>
		<!--									转发的原始微博	-->
											<c:if test="${weibo[7] ne 0 }">
											<div class="triangle forward_triangle"></div>
											<div class="clear"></div>
											<div id="forward" class="forward_wrap">
												<div id="forward_weibo">
													<c:choose>
														<c:when test="${weibo[8].primeWeibo eq null }">
															此微博已被原作者删除。
														</c:when>
														<c:otherwise>
															<div id="forward_weibo_content">
																<a href="#">${weibo[8].primeWeibo[4] }</a>：${weibo[8].primeWeibo[1] }
																<div class="picture">
																	<a href="${ctx }/uploads/${weibo[8].primeWeibo[7] }" class="thickbox">
																		<img src="${ctx }/uploads/${weibo[8].primeWeibo[7] }" title="查看大图"/>
																	</a>
																</div>
															</div>
															<div id="forward_weibo_info_left">
																${weibo[8].primeWeibo[2] }
																来自<a href="http://${weibo[8].primeWeibo[6] }" target="_blank">${weibo[8].primeWeibo[6] }</a>
															</div>
															<div id="forward_weibo_info_right">
																<a href="${ctx }/forward.jsp?height=270&width=450&modal=true&weiboid=${weibo[8].primeWeibo[0] }" class="thickbox">转发</a> 
																<a href="javascript:query_comment('${weibo[8].primeWeibo[0] }');" class="comment_btn">评论</a>
															</div>
														</c:otherwise>
													</c:choose>
												</div>
												<div class="clear"></div>
											</div>
											</c:if>
		<!--									/转发的原始微博	-->
											<div id="weibo_info">
												<div id="weibo_info_left">
													${weibo[3] }
													来自<a href="http://${weibo[5] }" target="_blank">${weibo[5] }</a>
												</div>
												<div id="weibo_info_right">
													<c:if test="${sessionScope.user.id == weibo[0] }">
														<a href="javascript:delete_weibo('${weibo[6] }');">删除</a>
													</c:if>
													<c:choose>
														<%-- 是转发微博并且源微博已被删除，不能再转发  --%>
														<c:when test="${(weibo[7] ne 0) and (weibo[8].primeWeibo eq null) }">
															<a href="${ctx }/alertforward.jsp?height=158&width=380&modal=true" class="thickbox">转发</a> 
														</c:when>
														<c:otherwise>
															<a href="${ctx }/forward.jsp?height=270&width=450&modal=true&weiboid=${weibo[6] }" class="thickbox">转发</a> 
														</c:otherwise>
													</c:choose>
													<a href="#">收藏</a>
													<a href="javascript:query_comment('${weibo[6] }');" class="comment_btn">评论</a>
												</div>
												<div class="clear"></div>
											</div>
		<!--									评论表单div 初始： display:none; ***id*** -->
											<div class="comment" id="${weibo[6] }">
												<div class="triangle comment_triangle"></div>
												<div class="clear"></div>
												<div class="comment_wrap">
													<div id="comment_content">
														<textarea class="weibo_comment" id="comment_content_${weibo[6] }" rows="1" cols="40"></textarea>
														<a href="javascript:add_comment('${weibo[6] }');" class="add_comment_btn">评论</a>
													</div>
													<div id="commentlist">
														<ul id="commentlist_${weibo[6] }"></ul>
													</div>
												</div>
											</div>
										</div>
										<div class="clear"></div>
									</li>
									</c:forEach>
								</ul>
							</div>
						</div>
						<div id="right">
							right...
						</div>
						<div class="clear"></div>
					</div>
				</div>
			</div>
			<div id="global_footer">
				footer...
			</div>
		</div>
	</body>
</html>
